<template>
    <div class="sequence">
        <el-input v-model="num" size="mini" style="width: 75px;" :maxlength="7"/>
    </div>
</template>

<script>
    export default {
        name: 'order',
        props: {
            value: '',
        },
        model: {
            props: 'value',
        },
        computed: {
            num: {
                get() {
                    return this.filter(this.value);
                },
                set(val) {
                    this.$emit('input', this.filter(val));
                }
            }
        },
        methods: {
            filter(str) {
                str = str.replace(/[^0-9]/ig, "");
                if (str) {
                    return parseInt(str) + '';
                } else {
                    return '0';
                }
            }
        }
    }
</script>
